<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateChatRoomsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('chat_rooms', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('chat_room_user_id')->comment('创建者id');
            $table->string('room_name')->nullable()->comment('群聊名称');
            $table->string('room_url')->nullable()->comment('群聊封面');
            $table->string('room_description')->nullable()->comment('群聊说明');
            $table->timestamps();
            $table->softDeletes();
            
            $table->index(['chat_room_user_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('chat_rooms');
    }
}
